package com.zdlyh.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
//使用@EnableOpenApi也行
@EnableSwagger2WebMvc
public class Knife4jConfig  {
    // 配置了swagger的Docket的bean的实例
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo());
    }

    // 配置swagger信息=apiInfo
    private ApiInfo apiInfo() {
        // 作者信息
        return new ApiInfoBuilder()
                .title("塑梦的博客项目文档")
                .description("Api Documentation")
                .version("1.0")
                .termsOfServiceUrl("https://baidu.com")
                .contact(new Contact("刘宇辉", "https://baidu.com/", "1816026989@qq.com"))
                .build();
    }
}
